@use 'design-system' as *;

.showcaseContainer {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    border-collapse: collapse;
    padding-top: $spacing-size-8;
    padding-bottom: $spacing-size-8;

    @media screen and (min-width: 768px) {
        grid-template-columns: repeat(3, 1fr);
    }
}

.showcaseGridItem {
    position: relative;
    display: flex;
    flex-direction: column;
    margin: -1px 0 0 -1px;
    padding: $spacing-size-8;
    background-color: var(--color-bg-primary);
    border: 1px solid var(--color-border-secondary);
    transition: background-color $transition-default-timing;

    // ::after used for hover border to avoid stacked border issues
    &::after {
        content: '';
        position: absolute;
        top: -1px;
        right: -1px;
        bottom: -1px;
        left: -1px;
        border: 1px solid transparent;
        z-index: 1;
        pointer-events: none;
        transition: border-color $transition-default-timing;
    }

    &:hover {
        background-color: var(--color-brand-50);

        &::after {
            border-color: var(--color-util-brand-500);
        }
    }

    @media screen and (max-width: 768px) {
        &:first-child,
        &:first-child::after {
            border-top-left-radius: var(--radius-md);
            border-top-right-radius: var(--radius-md);
        }

        &:last-child,
        &:last-child::after {
            border-bottom-left-radius: var(--radius-md);
            border-bottom-right-radius: var(--radius-md);
        }
    }

    @media screen and (min-width: 768px) {
        &:nth-child(1),
        &:nth-child(1)::after {
            border-top-left-radius: var(--radius-md);
        }

        &:nth-child(3),
        &:nth-child(3)::after {
            border-top-right-radius: var(--radius-md);
        }

        &:nth-child(4),
        &:nth-child(4)::after {
            border-bottom-left-radius: var(--radius-md);
        }

        &:nth-child(5),
        &:nth-child(5)::after {
            border-bottom-right-radius: var(--radius-md);
        }
    }

    #{$selector-darkmode} & {
        &:hover {
            background-color: var(--color-util-gray-100);

            &::after {
                border-color: var(--color-util-gray-500);
            }
        }
    }
}

.showcaseIconWrapper {
    display: flex;
    justify-content: space-between;
    margin-bottom: $spacing-size-4;
}

.showcaseLogo path,
.showcaseIcon path {
    fill: var(--icon-color);
}

.showcaseLogo {
    --icon-color: var(--color-fg-secondary);

    height: $spacing-size-10;
    opacity: 0.5;
    transition: opacity $transition-default-timing;
    display: inline-flex;
    align-items: center;

    .showcaseGridItem:hover & {
        opacity: 1;
    }
}

.showcaseIcon {
    --icon-color: var(--color-util-brand-500);

    width: $spacing-size-8;
    height: $spacing-size-8;

    #{$selector-darkmode} & {
        --icon-color: var(--color-white);
    }
}

.showcaseTitle {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: $spacing-size-3;
}

.showcaseDescription {
    font-size: var(--text-fs-sm);
    color: var(--color-text-secondary);
    opacity: 0.8;
    transition: opacity $transition-default-timing;
}

.showcaseLinksWrapper {
    display: flex;
    flex-wrap: wrap;
    gap: $spacing-size-2 $spacing-size-6;
    margin-top: auto;

    a {
        font-weight: var(--text-semibold);
    }
}

.githubLink svg {
    --icon-size: 22px;

    margin-right: 3px;
    margin-top: -3px;
}
